/**
 * Copyright (c) 2012-2014 All Rights Reserved.
 */
package com.easy.framwork;

import javax.sql.DataSource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.easy.framwork.config.LoadSystemConfig;
import com.easy.framwork.config.SystemConfig;
import com.easy.framwork.exceptions.ConfigException;

/**
 * 
 * @author wy
 * @version v 0.1 2014-1-5 下午10:09:43 wy Exp $
 */
public class FrameContext {

    private final static Logger log = LoggerFactory.getLogger(FrameContext.class);

    /** 系统配置 */
    private static SystemConfig systemConfig = null;

    /** 数据源 */
    private static DataSource dataSource = null;

    private FrameContext() {

    }

    /**
     * 构造config对象
     * 
     * @param config
     */
    public static void build(String config) {
        try {
            systemConfig = new LoadSystemConfig(config).config();
        }
        catch (Exception e) {
            log.error("初始化配置文件{}时出错:{}", config, e);
            throw new ConfigException("初始化配置文件" + config + "时出错");
        }
    }

    public static DataSource getDataSource() {
        if (dataSource == null) {

        }
    }

    /**
     * 根据插件名称获取
     * 
     * @param name
     * @return
     */
    public static Plugin getPlugin(String name) {

    }
    
}
